﻿using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MvcSample.TagHelpers
{
    public class MailTagHelper
        : TagHelper
    {
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var content = await output.GetChildContentAsync();
            var str = content.GetContent();

            output.TagName = "a";
            output.Attributes.SetAttribute("href",$"mailto:{str}");
            output.Content.SetContent(str);
        }
    }
}
